package com.fr.report.web.ui;

import com.fr.base.XMLable;
import com.fr.base.xml.BaseXMLUtils;
import com.fr.base.xml.XMLObject;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLReadable;
import com.fr.base.xml.XMLableReader;
import java.awt.Image;

public class Icon
  implements XMLable
{
  public static String XML_TAG = "Icon";
  private String name;
  private String path;
  private Image image;

  public Image getImage()
  {
    return this.image;
  }

  public void setImage(Image paramImage)
  {
    this.image = paramImage;
  }

  public Icon()
  {
  }

  public Icon(String paramString1, String paramString2)
  {
    this.name = paramString1;
    this.path = paramString2;
  }

  public Icon(String paramString, Image paramImage)
  {
    this.name = paramString;
    this.image = paramImage;
  }

  public String getName()
  {
    return this.name;
  }

  public void setName(String paramString)
  {
    this.name = paramString;
  }

  public String getPath()
  {
    return this.path;
  }

  private void setPath(String paramString)
  {
    this.path = paramString;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isChildNode())
    {
      Object localObject;
      String str = paramXMLableReader.getTagName();
      if ("NAME".equals(str))
      {
        localObject = null;
        if ((localObject = paramXMLableReader.getElementValue()) != null)
          setName((String)localObject);
      }
      else if ("PATH".equals(str))
      {
        localObject = null;
        if ((localObject = paramXMLableReader.getElementValue()) != null)
          setPath((String)localObject);
      }
      else if ("ICONIMAGE".equals(str))
      {
        localObject = new XMLObject(this, null)
        {
          private final Icon this$0;

          public void readXML()
          {
            if ((paramXMLableReader.isChildNode()) && (paramXMLableReader.getTagName().equals("Image")))
              this.obj = BaseXMLUtils.readImage(paramXMLableReader);
          }
        };
        paramXMLableReader.readXMLObject((XMLReadable)localObject);
        setImage((Image)((XMLObject)localObject).getObject());
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG(XML_TAG);
    if (getName() == null)
      return;
    paramXMLPrintWriter.startTAG("NAME").textNode(getName()).end();
    if (getPath() != null)
    {
      paramXMLPrintWriter.startTAG("PATH").textNode(getPath()).end();
    }
    else if (this.image != null)
    {
      paramXMLPrintWriter.startTAG("ICONIMAGE");
      BaseXMLUtils.writeImage(paramXMLPrintWriter, this.image);
      paramXMLPrintWriter.end();
    }
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}